import request from '@/utils/request'

/**
 * 查询企业的部门列表
 * @returns
 */
export function companyDepartment () {
  return request({
    url: '/company/department'
  })
}

/**
 *获取员工简单列表(只有名字和员工id)
 * @returns Promise对象
 */
export function sysUserSimple () {
  return request({
    url: '/sys/user/simple',
    method: 'get'
  })
}

/**
 * 新增部门
 * @param {*} data
 * @returns
 */
export function addCompanyDepartment (data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * 根据ID查询部门详情
 * @param {*} id
 * @returns
 */
export function getDepartDetailAPI (id) {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 根据ID修改部门详情
 * @param {*} formObj
 * @returns
 */
export function updateDepartmentsAPI (data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 根据ID删除部门
 * @param {*} departId
 * @returns
 */
export function delDepartmentAPI (departId) {
  return request({
    url: `/company/department/${departId}`,
    method: 'DELETE'
  })
}
